<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<link rel="stylesheet" type="text/css" href="/static/component/laytp/module/cityPicker/city-picker.css">

<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span>开标</span><div class="move_title"></div><?php include "../public/sub.php";?></div></div>
    <div class="main-container">
        <div class="block-generic">
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="edittits"><span>基本信息</span></div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">工程名称</label>
                        <div class="layui-input-block">
                            <input type="text" id="name" disabled autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>开标结果</label>
                        <div class="layui-input-block">
                            <select id="state" name="state" lay-filter="state"></select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-hide wininfo">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>中标日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="windt" id="windt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>中标价(元)</label>
                        <div class="layui-input-block">
                            <input type="text" id="winfee" name="winfee" placeholder="请输入" clearable autocomplete="off" class="layui-input moneyinput">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item height_auto">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label label_textarea">开标说明</label>
                        <div class="layui-input-block">
                            <textarea id="kaishuo" name="kaishuo" placeholder="请输入" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>


<!--            <div class="wininfo layui-hide">-->
<!--                <div class="layui-form-item">-->
<!--                    <div class="layui-row layui-col-space10">-->
<!--                        <div class="layui-col-md12">-->
<!--                            <label class="layui-form-label"><text>*</text>业绩是否录入平台</label>-->
<!--                            <div class="layui-input-block">-->
<!--                                <select id="islu" name="islu" lay-filter="islu">-->
<!--                                    <option value="是">是</option>-->
<!--                                    <option value="否" selected>否</option>-->
<!--                                </select>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
<!---->
<!--                <div class="layui-form-item layui-hide islu_shi">-->
<!--                    <div class="layui-row layui-col-space10">-->
<!--                        <div class="layui-col-md6">-->
<!--                            <label class="layui-form-label">项目经理</label>-->
<!--                            <div class="layui-input-block">-->
<!--                                <input type="text" readonly name="ren_xiang" class="layui-input ren_xiang" onclick="openPage('../public/choose_cert.php?dom=ren_xiang&page=bid_kai&choose_type=checkbox','80%','80%')">-->
<!--                                <div class="choose_div" id="ren_xiang" key="0"></div>-->
<!--                                <span class="choose_one" onclick="openPage('../public/choose_cert.php?dom=ren_xiang&page=bid_kai&choose_type=checkbox','80%','80%')"><i class="layui-icon layui-icon-search"></i></span>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                        <div class="layui-col-md6">-->
<!--                            <label class="layui-form-label">技术负责人</label>-->
<!--                            <div class="layui-input-block">-->
<!--                                <input type="text" readonly name="ren_ji" class="layui-input ren_ji" onclick="openPage('../public/choose_cert.php?dom=ren_ji&page=bid_kai&choose_type=checkbox','80%','80%')">-->
<!--                                <div class="choose_div" id="ren_ji" key="0"></div>-->
<!--                                <span class="choose_one" onclick="openPage('../public/choose_cert.php?dom=ren_ji&page=bid_kai&choose_type=checkbox','80%','80%')"><i class="layui-icon layui-icon-search"></i></span>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
<!--                <div class="layui-form-item layui-hide islu_shi">-->
<!--                    <div class="layui-row layui-col-space10">-->
<!--                        <div class="layui-col-md6">-->
<!--                            <label class="layui-form-label">质量负责人</label>-->
<!--                            <div class="layui-input-block">-->
<!--                                <input type="text" readonly name="ren_zhi" class="layui-input ren_zhi" onclick="openPage('../public/choose_cert.php?dom=ren_zhi&page=bid_kai&choose_type=checkbox','80%','80%')">-->
<!--                                <div class="choose_div" id="ren_zhi" key="0"></div>-->
<!--                                <span class="choose_one" onclick="openPage('../public/choose_cert.php?dom=ren_zhi&page=bid_kai&choose_type=checkbox','80%','80%')"><i class="layui-icon layui-icon-search"></i></span>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                        <div class="layui-col-md6">-->
<!--                            <label class="layui-form-label">安全负责人</label>-->
<!--                            <div class="layui-input-block">-->
<!--                                <input type="text" readonly name="ren_an" class="layui-input ren_an" onclick="openPage('../public/choose_cert.php?dom=ren_an&page=bid_kai&choose_type=checkbox','80%','80%')">-->
<!--                                <div class="choose_div" id="ren_an" key="0"></div>-->
<!--                                <span class="choose_one" onclick="openPage('../public/choose_cert.php?dom=ren_an&page=bid_kai&choose_type=checkbox','80%','80%')"><i class="layui-icon layui-icon-search"></i></span>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->






            <?php include '../public/upinfo.php'?>
        </div>

    </div>
</form>
<script>
    var param_id = getQueryVariable('id') || 0;


    $("#commentForm").validate({
        rules: {
            windt: {required: true},
            winfee: {required: true},
        },
        messages:{
            windt: {required: "请选择"},
            winfee: {required: "请输入"},
        }
    });

    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        facade.ajax({type: 'get', url: ask_bid_kai,data:{id:param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;

                $('#name').val(data.name);
                $('#windt').val(data.windt);
                $('#winfee').val(data.winfee);
                $('#kaishuo').val(data.kaishuo);



                var kai_guo_str = '<option value="">请选择</option>';
                var kai_guo = res.data.kai_guo;
                for (var key in kai_guo){
                    if(data.state == key){
                        kai_guo_str += '<option value="'+key+'" selected>'+kai_guo[key]+'</option>';
                    }else{
                        kai_guo_str += '<option value="'+key+'">'+kai_guo[key]+'</option>';
                    }
                }
                $("#state").html(kai_guo_str);

                if(data.state == 3){
                    $(".wininfo").removeClass('layui-hide');

                    if(data.islu == '是'){
                        $(".islu_shi").removeClass('layui-hide');

                        for (var key in res.data.ren_xiang_info){
                            set_choose_btn('ren_xiang',res.data.ren_xiang_info[key].id,res.data.ren_xiang_info[key].name);
                        }
                        for (var key in res.data.ren_ji_info){
                            set_choose_btn('ren_ji',res.data.ren_ji_info[key].id,res.data.ren_ji_info[key].name);
                        }
                        for (var key in res.data.ren_zhi_info){
                            set_choose_btn('ren_zhi',res.data.ren_zhi_info[key].id,res.data.ren_zhi_info[key].name);
                        }
                        for (var key in res.data.ren_an_info){
                            set_choose_btn('ren_an',res.data.ren_an_info[key].id,res.data.ren_an_info[key].name);
                        }
                    }
                }



                public_upload_file_load('upload_files', res.data.files);
                render_date();
                render_from();
                initParseMoney();
            }
        });

        form.on('select(state)', function(data){
            if(data.value == 3){
                $(".wininfo").removeClass('layui-hide');
            }else{
                $(".wininfo").addClass('layui-hide');
            }
        });

        form.on('select(islu)', function(data){
            if(data.value == '是'){
                $(".islu_shi").removeClass('layui-hide');
            }else{
                $(".islu_shi").addClass('layui-hide');
            }
        });



        form.on('submit(add)', function(data){

            data.field.ren_xiang = get_choose_val('ren_xiang');
            data.field.ren_ji = get_choose_val('ren_ji');
            data.field.ren_zhi = get_choose_val('ren_zhi');
            data.field.ren_an = get_choose_val('ren_an');

            var validRes = $("#commentForm").valid();
            if(!validRes){return false;}

            data = parseMoney(data);
            data.field.id = param_id;
            data.field.files = public_upload_file_value('upload_files');
            facade.ajax({url: ask_bid_kai, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    dataPostTimeOut();
                }
            });

            return false;
        });

    });

</script>
</body>
</html>
